<template>
  <div class="home-page">
    <section class="pl-5 text-center container">
      <div class="row py-lg-5">
        <div class="col-lg-6 col-md-8 mx-auto">
          <img src="../assets/patterns.e8579768.png" alt="" class="w-50">
          <h2>随心写作，自由表达</h2>
          <router-link to="/create" class="btn btn-primary my-2">开始写文章</router-link>
        </div>
      </div>
    </section>
    <h4 class="font-weight-bold text-center">发现精彩</h4>
    <colmunList :list="list"></colmunList>
  </div>
</template>

<script lang="ts">
import {computed, defineComponent, onMounted} from "vue";
import { testData } from "@/testData";
import ColmunList from "@/components/ColmunList.vue";
import {useStore} from "vuex";
import {GolbalDataProps} from "@/store";
import router from "@/router";


export default defineComponent({
  components:{
    ColmunList,
},
  setup() {
    const store = useStore<GolbalDataProps>()
    const list = computed(() => store.state.columns)
    const biggerColumnLen = computed(() => store.getters.biggerColumnLen)
    // 组件挂载的使用调用请求
    onMounted(() => {
      store.dispatch('fetchColumns')
    })
    return {
      list:list,
      biggerColumnLen
    }
  }
})
</script>

<style>

</style>
